import java.util.*;
public class week2_task10 
{
	//the process is (leapyear+365)-(day+(month-1)*month_to_day[month-1])
	// when it is leapyear, change the month_to_day[1] to 29 instead of 28
		 static int year;
		 static int month;
		 static int day;
		 static int[] month_to_day ={31,28,31,30,31,30,31,31,30,31,30};
		 static int total_months_in_days = 0;
		 static int leapyear = 0;
		public static void main(String[] args) 
		{
	
			Scanner scan = new Scanner(System.in);
			System.out.println("Please enter the date");
			day=scan.nextInt();
			System.out.println("Please enter the month");
			month=scan.nextInt();
			System.out.println("Please enter the year");
			year=scan.nextInt();
			
			leapyear = IsLeapYear(year);
			if (leapyear==1)
				month_to_day[1]=29;
			totalMonthsInDays(month);
			calculateDaysLeft(day,month,year);
		}
		
		
		public static void totalMonthsInDays(int month)
		{
			for(int i = 0; i < month -1; i++)
			{
				total_months_in_days += month_to_day[i];
			}
		
		}
		
		public static void calculateDaysLeft(int day, int month, int year)
		{
			int output;
			output = (leapyear+365)-(day+total_months_in_days);
			System.out.println("there are	"+output+"	days remaining until the end of the year");
		}
		
		public static int IsLeapYear(int year)
		{
			int return_value = 0;
			if (year%4==0)
			{
				if(year%100==0)
				{
					if(year%400==0)
					{
						return_value = 1;
					}
				}
				else
				{
					return_value = 1;
				}
			}
			
			return return_value;
		}
}
